package org.september.pisces.operation.util;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component
@ConfigurationProperties(prefix = "spring.alliance.dao")
public class DatasourceConfigUtil {

    private List<DataSourceConfig> datasource;

    private static DatasourceConfigUtil instance;

    public DatasourceConfigUtil() {
        instance = this;
    }

    public static List<DataSourceConfig> getDatasource() {
        return instance.datasource;
    }

    @Data
    public static class DataSourceConfig {
        private String group;
        private String type;
        private String driverClass;
        private String jdbcUrl;
        private String username;
        private String password;
    }
}
